import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
// import './plugins/element.js'
import './styles/global.css'
import './assets/fonts/iconfont.css'
import ZkTable from 'vue-table-with-tree-grid'
import util from './util.js'
import VueQuillEditor from 'vue-quill-editor'
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
// 导入进度条插件
import NProgress from 'nprogress'
// 导入进度条样式
// import 'nprogress/nprogress.css'

// 树状表格插件
Vue.use(ZkTable)
// 富文本编辑器插件
Vue.use(VueQuillEditor /* { default global options } */)

// 修改axios的默认url前缀配置
axios.defaults.baseURL = 'http://liufusong.top:8888/api/private/v1/'
// axios请求拦截器
axios.interceptors.request.use(config => {
  NProgress.start()
  config.headers.Authorization = sessionStorage.getItem('token')
  return config
})
// axios响应拦截器
axios.interceptors.response.use(res => {
  NProgress.done()
  return res.data
})
Vue.prototype.$axios = axios

Vue.config.productionTip = false // 组织Vue在启动时生成生产提示
// 格式化时间过滤器
Vue.filter('formDate', (time, format) => {
  return util.dateFormat(time, format)
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
